#include "ShotgunShellRacruvido.h"
#include <GL/glu.h>
#include "gllib/Objects.h"
#include "src/mathlib/Matrix4.h"
#include <cmath>

void ShotgunShellRacruvido::draw()
{
    double raio = 0.5;
    double precisao = 10.0;
    double topo_raio = raio*1.1;
    double topo_comprimento = 0.1;
    double meio_comprimento = 1.0;
    double fundo_comprimento = 1.5;
    double detalhe_raio = 0.3;
    double detalhe_comprimento = 0.02;

    // Deitar o cartucho:
    rotationMatrix(rad(270),Vector3(1.0,0.0,0.0)).applyGL();

    // Diminuir o cartucho:
    scaleMatrix(0.24).applyGL();

    /// *** Topo (detalhe) ******************************************************************* ///
    glColor3f(0.0, 0.3, 0.0);
    glPushMatrix();
        translationMatrix(Vector3(0.0,topo_comprimento+meio_comprimento+(detalhe_comprimento/2.0),0.0)).applyGL();
        gllibCylinder(detalhe_raio,detalhe_comprimento,precisao);
    glPopMatrix();
    /// ************************************************************************************** ///


    /// *** Topo ***************************************************************************** ///
    glColor3f(0.0, 0.7, 0.0);
    glPushMatrix();
        translationMatrix(Vector3(0.0,meio_comprimento+(topo_comprimento/2.0),0.0)).applyGL();
        gllibCylinder(topo_raio,topo_comprimento,precisao);
    glPopMatrix();
    /// ************************************************************************************** ///


    /// *** Meio ***************************************************************************** ///
    glColor3f(0.0, 0.8, 0.0);
    glPushMatrix();
        translationMatrix(Vector3(0.0,(meio_comprimento/2.0),0.0)).applyGL();
        gllibCylinder(raio,meio_comprimento,precisao);
    glPopMatrix();
    /// ************************************************************************************** ///


    /// *** Fundo **************************************************************************** ///
    glColor3f(1.0, 0.0, 0.0);
    glPushMatrix();
        translationMatrix(Vector3(0.0,-(fundo_comprimento/2.0),0.0)).applyGL();
        gllibCylinder(raio,fundo_comprimento,precisao);
    glPopMatrix();
    /// ************************************************************************************** ///
}
